
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>表单</title>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css">
    <link rel="stylesheet" href="__PUBLIC__/static/css/style.css">
    <link rel="icon" href="__PUBLIC__/static/image/code.png">
</head>
<body class="body">


<form class="layui-form" action="" method="post" id="addform">

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-inline">
                <input type="type" name="user_name" lay-verify="required" autocomplete="off" class="layui-input" value="{$info.user_name}" disabled="">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-inline">
            <input type="password" name="password" lay-verify="pass" placeholder="请输入密码" autocomplete="off" class="layui-input" value="">
        </div>
        <div class="layui-form-mid layui-word-aux">请填写6到12位密码</div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">用户称呼</label>
            <div class="layui-input-inline">
                <input type="type" name="nickname" lay-verify="" autocomplete="off" class="layui-input" value="{$info.nickname}">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">邮箱</label>
            <div class="layui-input-inline">
                <input type="text" name="email" lay-verify="email" autocomplete="off" class="layui-input" value="{$info.email}" >
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <input type="radio" name="sex" value="1" title="男" checked="" {$info.sex ==1 ? 'checked=""' :''}>
            <input type="radio" name="sex" value="0" title="女" {$info.sex ==0 ? 'checked=""' :''}>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-block">
            <input type="radio" name="status" value="1" title="正常" {$info.status ==1 ? 'checked=""' :''}>
            <input type="radio" name="status" value="0" title="禁用" {$info.status ==0 ? 'checked=""' :''}>
        </div>
    </div>

    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入内容" class="layui-textarea" name="remark"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
{notempty name="$info"}
  <input type="hidden" name="id" value="{$info.id}">
{/notempty}    
</form>
<!-- 通用-970*90 -->


<script src="__PUBLIC__/layui/layui.js" charset="utf-8"></script>
<script src="__ADMIN__/js/comm.js" charset="utf-8"></script>
<script>
    layui.use(['layer','form','admin'], function(){
        var layer = layui.layer
            ,$ = layui.jquery
            ,form = layui.form
            ,admin = layui.admin;

        //自定义验证规则
        form.verify({
            title: function(value){
                if(value.length < 5){
                    return '标题至少得5个字符啊';
                }
            }
            ,content: function(value){
                layedit.sync(editIndex);
            }
        });





        //监听指定开关
        // form.on('switch(switchTest)', function(data){
        //     layer.msg('开关checked：'+ (this.checked ? 'true' : 'false'), {
        //         offset: '6px'
        //     });
        //     layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是ON|OFF', data.othis)
        // });

        //监听提交
       
        form.on('submit(demo1)', function(data){
            admin.action('{:url('admin/Member/edit')}',$("#addform").serialize());
            return false;
        });


    });

// function actajax(argument) {
//             //监听提交 $("#testform").serialize()
//         var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
//         //form.on('submit(demo1)', function(data){
//                 $.post('{:url('edit')}',$("#addform").serialize(),function(data){
//                     if(data.code == 1){
//                         layer.alert(data.msg, {
//                           skin: 'layui-layer-molv' //样式类名
//                           ,closeBtn: 0
//                         }, function(){
//                             parent.layer.close(index);
//                         });
//                         //layer.msg(data.msg);
//                     }else{
//                         layer.msg(data.msg);
//                     }
//                 });
//             //return false;
//         //});
// }






</script>
</body>
</html>